import * as THREE from 'three';

export default function createLine() {

  // 创建一个空的几何体顶对象
  const geometry = new THREE.BufferGeometry();
  // 类型化数组定义的一组顶点坐标数据
  const vertices = new Float32Array([
    0, 0, 0, //顶点1坐标
    50, 0, 0, //顶点2坐标
    0, 100, 0, //顶点3坐标
    0, 0, 10, //顶点4坐标
    0, 0, 100, //顶点5坐标
    50, 0, 10, //顶点6坐标
  ]);
  // BufferAttribute属性缓冲对象表示顶点数据
  const attribute = new THREE.BufferAttribute(vertices, 3);
  // 设置几何体的顶点位置属性
  geometry.attributes.position = attribute;

  const material = new THREE.LineBasicMaterial({
    color: 0xffff00,
  })

  return new THREE.Line(geometry, material);
}